package fr.lelouet.monitoring.impl

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import fr.lelouet.monitoring.datahandlers.SnapshotDataHandler 
import fr.lelouet.monitoring.snapshot.receivers.DirectoryWriter 
import fr.lelouet.monitoring.snapshot.receivers.GraphReceiver 
import fr.lelouet.monitoring.snapshot.receivers.LoggerReceiver
import fr.lelouet.tools.Main;

import static fr.lelouet.monitoring.impl.KvmHypervisor.*

/** a main for simply monitoring, with debug, graphs and adding the data in a directory*/
class LocalHypervisorMonitor {
	
	private static final Logger logger = LoggerFactory.getLogger(LocalHypervisorMonitor.class)
	
	/** the default configuration writes the snapshots in a folder in local dir, with all events monitored*/
	static void main(args) {
		Properties prop = new Properties()
		prop.setProperty(POWERURI_KEY, "plugwise://000D6F000076A98E")
		prop.setProperty(HANDLERS_KEY, SnapshotDataHandler.class.getCanonicalName())
		prop.setProperty DirectoryWriter.OUTPUTDIR_KEY, "snapshots"
		prop.setProperty SnapshotDataHandler.SNAPSHOTRECEIVERS_KEY, DirectoryWriter.class.getCanonicalName()+" "+LoggerReceiver.class.getCanonicalName()+" "+GraphReceiver.class.getCanonicalName()
		Main.getProperties(args, prop)
		logger.info ("starting hypervisor monitor with properties : "+prop.toString())
		KvmHypervisor localHypervisor = new KvmHypervisor(prop);
		localHypervisor.run()
	}
}
